package org.centsuse.intention_spring.invention.segmentation.controller;

import lombok.RequiredArgsConstructor;
import org.centsuse.intention_spring.invention.segmentation.clients.DeepSeekLegacyClient;
import org.centsuse.intention_spring.invention.segmentation.dto.DpChatRequest;
import org.centsuse.intention_spring.invention.segmentation.dto.DpChatResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/deepseek")
@RequiredArgsConstructor
public class ChatController {

    private final DeepSeekLegacyClient deepSeekClient;

    @GetMapping("/chat")
    public ResponseEntity<DpChatResponse> chat() {
        List<DpChatRequest.Message> messages = new ArrayList<>();
        DpChatRequest.Message message = new DpChatRequest.Message("user", "怎么看待红楼梦");
        messages.add(message);
        return ResponseEntity.ok(deepSeekClient.chatCompletion(new DpChatRequest(messages)));
    }
}
